<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>模板语法-文本</title>
  <style>
  .box {
    width: 200px;
    height: 200px;
    background-color: #f66;  
  }
  </style>
</head>
<body>
  <div id="app">
    <div class="box" v-on:click="showBox">
      <button class="btn" v-on:click="showBtn">点击</button>
    </div>
  </div>
</body>
<script src="vue.js"></script>
<script>
  new Vue({
    el: '#app',
    data: {
      msg: 'hello vue'
    },
    methods: {
      showBox (event) {
        event.preventDefault(); // 阻止默认事件
        console.log('box')
      },
      showBtn (event) {
        event.stopPropagation(); // 阻止冒泡
        console.log('btn')
      }
    }
  })
</script>
</html>